package com.sgb.kjwl.view.ui.adapter.self.pick;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.user.OfferEntity;
import com.sgb.kjwl.model.entity.user.UserLaborEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class UserOfferAdapter extends BaseRecycleAdapter<OfferEntity> {

    public UserOfferAdapter(Context context, List<OfferEntity> datas) {
        super(context, R.layout.item_user_offer, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final OfferEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        ImageView ivImg = holder.getItem().findViewById(R.id.iv_img);

        if (entity.getStatus().equals("1")){//已报价
            ivImg.setImageDrawable(context.getResources().getDrawable(R.drawable.icon_offered));
        }else if (entity.getStatus().equals("2")){//入围
            ivImg.setImageDrawable(context.getResources().getDrawable(R.drawable.icon_to_next));
        }else if (entity.getStatus().equals("3")){//中标
            ivImg.setImageDrawable(context.getResources().getDrawable(R.drawable.icon_bided));
        }else if (entity.getStatus().equals("4")){//未中标
            ivImg.setImageDrawable(context.getResources().getDrawable(R.drawable.icon_no_bid));
        }
    }

    private UserOfferAdapter.onEditClickListener editClickListener;

    public void setonEditClick(UserOfferAdapter.onEditClickListener editClickListener) {
        this.editClickListener = editClickListener;
    }

    public interface onEditClickListener {
        void onDetailedListClick(OfferEntity entity, int position);
    }
}
